package cn.sinata.wanglin.adapter;

import android.content.Context;
import android.net.Uri;

import com.facebook.drawee.view.SimpleDraweeView;
import com.xilada.xldutils.adapter.ListAdapter;
import com.xilada.xldutils.view.utils.ViewHolder;

import java.util.List;

import cn.sinata.wanglin.R;
import cn.sinata.wanglin.model.Group;
import cn.sinata.wanglin.utils.ImageUtil;

/**
 *
 * Created by liaoxiang on 16/12/12.
 */

public class GroupAdapter extends ListAdapter<Group> {

    public GroupAdapter(Context context, List<Group> mData) {
        super(context,mData, R.layout.item_group_list_layout);
    }

    @Override
    protected void onBind(int position, Group group, ViewHolder holder) {
        SimpleDraweeView groupImageView = holder.bind(R.id.groupImageView);
        groupImageView.setImageURI(ImageUtil.parseImageUri(group.getGroupImg()));
        holder.setText(R.id.tv_group_name,group.getGroupName());
        holder.setText(R.id.tv_member_count,group.getGroupsCount()+"人");
        holder.setText(R.id.tv_group_tags,group.getGroupLable());
        holder.setText(R.id.tv_group_description,group.getGroupInfo());
    }
}
